﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLite.Domain.Cfg;
using NLite.Domain.Wcf.Client;
using NLite.Cfg;

namespace NLite.Domain.Wcf.Cfg
{
    public class ClientServiceDispatcherConfigurationItem : Extension<NdfConfigurationItem>
    {
        string Address;
        System.ServiceModel.Channels.Binding Binding;

      
        public ClientServiceDispatcherConfigurationItem(string address, System.ServiceModel.Channels.Binding binding)
        {
            Address = address;
            Binding = binding;
        }
      
        public override void Attach(NdfConfigurationItem owner)
        {
            owner.ServiceDispatcherCreator = () => new ServiceDispatcherClient(Address, Binding);
        }

        public override void Detach(NdfConfigurationItem owner)
        {
            owner.ServiceDispatcherCreator = null;
        }
    }
}
